package com.example.demo.Config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created by xiebang
 * Description
 * User:小谢
 * Date:2022-09-20
 * Time:16:31
 */
@Configuration
public class AppConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/login.html")
                .excludePathPatterns("/register.html")
                .excludePathPatterns("/updateUser.html")
                .excludePathPatterns("/deleteUser.html")
                .excludePathPatterns("/register")
                .excludePathPatterns("/updateUser")
                .excludePathPatterns("/deleteUser")
                .excludePathPatterns("/login")
                .excludePathPatterns("/**/*.png")
                .excludePathPatterns("/**/*.css")
                .excludePathPatterns("/**/*.js")
        ;
    }
}
